#include "orderlistitem.h"
#include "ui_orderlistitem.h"
#include "database.h"

OrderListItem::OrderListItem(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::OrderListItem)
{
    ui->setupUi(this);
}

OrderListItem::~OrderListItem()
{
    delete ui;
}


////更新订单项信息
/// orderformnumber 0
/// AccountNumber   1
/// modelnumber		2
/// bargaintime		3
/// assessment		4
/// actuallypaid	5
/// orderstate      6
void OrderListItem::updateItemInfo(QVector<QString> UserOrderFormList, char i)
{
    Database db;
    QVector<QString> PhoneInfo = db.GetPhoneInfo(UserOrderFormList.at(2 + i*8));
    QString PictureName = "../Phone_platform/sources/picture" + PhoneInfo.at(4) + "001.jpg";
    ui->lb_orderformnumber->setText(UserOrderFormList.at(0 + i*8));
    ui->lb_modelnumber->setText(UserOrderFormList.at(2 + i*8));
    ui->lb_bargaintime->setText(UserOrderFormList.at(3 + i*8));
    ui->lb_assessment->setText(UserOrderFormList.at(4 + i*8));
    ui->lb_actuallypaid->setText(UserOrderFormList.at(5 + i*8));
    ui->lb_orderstate->setText(UserOrderFormList.at(6 + i*8));
    ui->lb_picture->setPixmap(QPixmap::fromImage(QImage(PictureName)));
}


///删除订单
/// 功能：从用户数据库中删除相关订单信息
void OrderListItem::on_pb_RemoveFromOrder_clicked()
{
    emit RemoveFromOrder(ui->lb_orderformnumber->text());
}









